fix Qt version dependencies (#922)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Sat, 24 Sep 2022 14:09:58 +0000 (08:09 -0600)
committerGitHub <noreply@github.com>
Sat, 24 Sep 2022 14:09:58 +0000 (08:09 -0600)
* fix some Qt version dependencies.

* disable strptime warning.

CMakeLists.txt
gui/formatload.cc
gui/mainwindow.cc

index 5a8198234f8ff1455a542a36cb52d39a64abbb73..f7e82bd3e7fafb077a6854503c4db30033d37862 100644 (file)
@@ -293,6 +293,8 @@ if(UNIX)
   set(SOURCES ${SOURCES} gbser_posix.cc)
   set(HEADERS ${HEADERS} gbser_posix.h)
   target_compile_options(gpsbabel PRIVATE -Wall)
+  # disable warning from strptime.c, which we don't want to own or modify
+  set_source_files_properties(strptime.c PROPERTIES COMPILE_OPTIONS -Wno-unused-but-set-variable)
 endif()
 
 if(WIN32)
index a0af91be6df889932fab811a1a54ab69e9b612dd..23d24fb39c915f4a7064a4634cbc93aaa21264b9 100644 (file)
@@ -25,9 +25,6 @@
 #include <QByteArray>                      // for QByteArray
 #include <QChar>                           // for operator==, QChar
 #include <QCoreApplication>                // for QCoreApplication
-#ifdef GENERATE_CORE_STRINGS
-#include <QDebug>                          // for QDebug, operator<<
-#endif
 #include <QObject>                         // for QObject
 #include <QProcess>                        // for QProcess
 #include <QRegularExpression>              // for QRegularExpression
@@ -37,6 +34,9 @@
 #include <QVariant>                        // for QVariant
 #include <QApplication>                    // for QApplication
 #include <QMessageBox>                     // for QMessageBox
+#ifdef GENERATE_CORE_STRINGS
+#include <QtGlobal>                        // for QT_VERSION, QT_VERSION_CHECK
+#endif
 #include "appname.h"                       // for appName
 
 
@@ -48,7 +48,11 @@ extern QTextStream* generate_output_stream;
 static QString xlt(const QString& f)
 {
 #ifdef GENERATE_CORE_STRINGS
+#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
+  *generate_output_stream << "QT_TRANSLATE_NOOP(\"core\",\"" << f << "\")" << endl;
+#else
   *generate_output_stream << "QT_TRANSLATE_NOOP(\"core\",\"" << f << "\")" << Qt::endl;
+#endif
 #endif
   return QCoreApplication::translate("core", f.toUtf8().constData());
 }
index 4c4c27d735a98fd05576a0d290cf4c0a9b03fc14..ac0643bdef5912ea86792fd460ae3fe6beb8f3e2 100644 (file)
@@ -271,7 +271,11 @@ void MainWindow::switchTranslator(QTranslator& translator, const QString& filena
   const QStringList directories = {
     QApplication::applicationDirPath() + "/translations",
     ":/translations",
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
     QLibraryInfo::location(QLibraryInfo::TranslationsPath)
+#else
+    QLibraryInfo::path(QLibraryInfo::TranslationsPath)
+#endif
   };
 
   // Load the new translator.